package cn.net.shuxing.yifu.common.back.controller;

import cn.net.shuxing.yifu.common.bean.CardType;
import cn.net.shuxing.yifu.common.bean.CoinType;
import cn.net.shuxing.yifu.common.bean.ShareholderLevelList;
import cn.net.shuxing.yifu.common.dto.BaseDto;
import cn.net.shuxing.yifu.common.service.CardTypeService;
import cn.net.shuxing.yifu.common.service.CoinTypeService;
import cn.net.shuxing.yifu.common.service.ShareholderLevelListService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/back")
public class CommonController {

    @Autowired
    private CoinTypeService coinTypeService;

    @Autowired
    private CardTypeService cardTypeService;

    @Autowired
    private ShareholderLevelListService shareholderLevelListService;
    @RequestMapping("/coinType/list")
    public BaseDto getAllCoinType() {
        List<CoinType> coinTypeList = coinTypeService.getAll();
        return BaseDto.ok(coinTypeList);
    }

    @RequestMapping("/cardType/list")
    public BaseDto getAllCardType() {
        List<CardType> cardTypeList = cardTypeService.getAllWithoutComplete();
        return BaseDto.ok(cardTypeList);
    }

    @RequestMapping("/level/list")
    public BaseDto getLevelList(){
        List<ShareholderLevelList> all = shareholderLevelListService.getAll();
        return BaseDto.ok(all);
    }

    @RequestMapping("/level/select")
    public BaseDto getLevelSelect(Integer levelId){
        ShareholderLevelList levelList = shareholderLevelListService.getByPrimaryKey(levelId);
        return BaseDto.ok(levelList);
    }

}
